Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Inventory Management with Ucommerce

When Ucommerce was introduced to the world at Codegarden ‘09 one of the things we demoed was how to build simple inventory management using the API and pipelines.

The great thing about pipelines is that they’re very easy to extend so we didn’t think to actually include the inventory tasks; until now that is.

What does it do

The pipeline tasks are pretty simple and do one thing: During checkout, one task looks for a field on your product definition called “InventoryOnHand” if found decrements that field with the quantity ordered by the customer. It’s that easy.

Now inventory management wouldn’t be complete if it didn’t support returns as well. So a second task is configured to run as part of the order processing flow in the backend of Ucommerce. If an order is moved to a canceled state the task looks for that same field once more and increments “InventoryOnHand” with the quantities found on each order line.

Setting it up

As mentioned the inventory tasks “DecrementInventoryOnHand” and “IncrementInventoryOnHand” looks for a field called “InventoryOnHand”. So you need to add to your product definitions for inventory management to kick in. You’re free to have the field only on some product and not on others. The tasks will adapt to whatever the case might be.

One thing to note is that if you’re operating with variants you want to add the “InventoryOnHand” field as a variant property otherwise Ucommerce won’t pick it up.

If you don’t use variants just leave Variant Property off.

image

Managing Inventory Levels

With the new field in place, you can now manage inventory levels on products or variants as you would any other product property.

image

Cancelled Orders

The store owner might decide to cancel an order in which case the quantities ordered need to be returned as inventory. IncrementInventoryOnHand handles this for you.

image

Pipelines

Configuring the two components and adding them to "Checkout" and "ToCancelled" pipelines can be done using the example configuration file called: Apps\SimpleInventory.disabled\InventoryOnHand.config

Simply remove the ".disabled" part of the folder name and restart your website for the new configuration to take effect!

Wrap Up

That’s it. With two pretty simple tasks, Ucommerce now has a simple inventory management built right in.